package com.lucian.ge.controller.shopportal;

import com.lucian.ge.auth.controller.GetAuthController;
import com.lucian.ge.user.mapper.UserMapper;
import com.lucian.ge.comman.model.ResultMap;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * Created by Lucicol on 2019/6/24.
 */
@Api(value = "RegisteredUserController", description = "普通注册用户接口")
@RestController
@RequestMapping("/shop/user")
public class RegisteredUserController {
    private final ResultMap resultMap;

    @Autowired
    public RegisteredUserController(ResultMap resultMap) {
        this.resultMap = resultMap;
    }

    @ApiOperation(value="普通注册用户登录验证", notes="")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="header", name = "token", value = "token", required = false, dataType = "String")
    })
    @GetMapping("/lslogin")
    @ResponseBody
    public ResultMap isLogin(@RequestHeader String token,@RequestHeader Integer userId) {
        if (!GetAuthController.getUserAuth(token, userId).equals("普通注册用户验证通过")) {
            return resultMap.success().code(200).message(GetAuthController.getUserAuth(token, userId)).token("").res("").data(null);
        }
        return resultMap.success().code(200).message("普通注册用户已登录").token("").res("").data(null);
    }

    }
